package com.serviceprovider.business.module.sp.transaction.services.dao.interfaces;

//~--- non-JDK imports --------------------------------------------------------

import com.serviceprovider.business.module.admin.transaction.valueobjects.AdminTransactionCriteria;
import com.serviceprovider.business.module.common.Page;
import com.serviceprovider.business.module.sp.transaction.model.TransactionCriteria;
import com.serviceprovider.business.module.sp.transaction.model.TransactionDetail;
import com.serviceprovider.business.module.user.model.impl.User;

//~--- JDK imports ------------------------------------------------------------

import java.util.List;

/**
 * @author mrduongnv@gmail.com
 *
 */
public interface ITransactionDao {

    /**
     * Return transaction by a criteria
     */
    List<TransactionDetail> findByCriteria(TransactionCriteria criteria);

    /**
     * Return the transaction by user's ID
     */
    List<TransactionDetail> findTransactionsByUserId(int userId);

    /**
     * Load transaction by it's ID
     */
    TransactionDetail getTransactionById(int id);

    /**
     * Return the list of transaction by batch's ID
     */
    List<TransactionDetail> findTransactionsByBatch(int batchId);

    /**
     * Return the list of transaction by payee's ID
     */
    List<TransactionDetail> findTransactionsByPayee(int payeeid);

    /**
     * Return the list of payees of a specific transaction
     */
    List<User> findPayeeListOnTransaction(TransactionDetail transaction);

    /**
     * Return the list of Transaction by service provider & batch
     */
    List<TransactionDetail> findByProviderAndBatch(int providerId, int batchId);

    /**
     * Insert transaction to the database
     */
    TransactionDetail insertTransaction(TransactionDetail transaction);

    /**
     * Delete transaction
     */
    void deleteTransaction(int transactionId);

    /**
     * Update transaction information
     */
    void updateTransaction(TransactionDetail transaction);

    /**
     * Update transaction status of a specific transaction
     */
    void updateTransactionStatus(int transactionId, int transactionStatusId);

    void updateTransactionSelfFee(int transactionId, int selfFee);

    /**
     * Return the list of transaction in a batch
     */
    List<TransactionDetail> findNumberOfTransactionsInABatch(int batchid);

    /**
     * Transaction's pagination
     */
    Page<TransactionDetail> find(int pageNumber, int pageSize, String sortColumn, String sortOrder);

    /**
     * Return the new transaction
     */
    List<TransactionDetail> findNewTransactions(int providerid);

    List<TransactionDetail> findTransactionsbyStatus(int statusid, int providerId);

    /**
     * Move the list of transaction to new
     */
    void moveTransactionsToNew(List<Integer> ids);

    /**
     * Return the number of transaction in a batch
     */
    int countByBatchId(Integer id);

    void updateTransactaionCustomerBalance(int transactionId, int customerBalance);

    List<TransactionDetail> findByAdminCriteria(AdminTransactionCriteria criteria);

    void moveTransactionToProvider(int transactionId, int providerId);

    public List<TransactionDetail> getMatchedTransactionDetails(Integer transactionId, Integer customerSSN);

    void moveTransactionsToNewStatus(List<Integer> ids);
}



